package com.cvmars.jianyou.module.adapter;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.cvmars.jianyou.R;
import com.cvmars.jianyou.config.MyConfig;
import com.cvmars.jianyou.model.ImageUploadModel;
import com.cvmars.jianyou.model.UserModel;
import com.cvmars.jianyou.module.activity.PersonHomeActivity;
import com.cvmars.jianyou.module.base.BaseImagePagerActivity;
import com.cvmars.jianyou.module.model.FindModel;
import com.cvmars.jianyou.module.model.TopicModel;
import com.cvmars.jianyou.ui.CircleImageView;
import com.cvmars.jianyou.utils.ImageUtils;
import com.cvmars.jianyou.utils.UtilHelper;

import java.io.Serializable;
import java.util.List;

/**
 * Created by hehaifeng on 2018/12/23.
 */

public class FindTopicAdapter extends BaseQuickAdapter<TopicModel, BaseViewHolder> {


    Context mContext;

    public FindTopicAdapter(Context context, int layoutResId, @Nullable List<TopicModel> data) {
        super(layoutResId, data);
        mContext = context;
    }

    @Override
    protected void convert(BaseViewHolder helper, TopicModel item) {


        helper.setText(R.id.txt_title, "#" + item.name + "#");

        TextView txt_title = helper.getView(R.id.txt_title);

        int position = helper.getAdapterPosition();

        if(position < 3){

            txt_title.setTextColor(ContextCompat.getColor(mContext,R.color.m2));
        }else{

            txt_title.setTextColor(ContextCompat.getColor(mContext,R.color.color333));
        }

        if(position == 0){

            txt_title.setTextColor(ContextCompat.getColor(mContext,R.color.m1));

        }


        ImageView ivTopic = helper.getView(R.id.iv_topic);
        ImageUtils.loadImage(mContext,item.logo_url,ivTopic);

        helper.setText(R.id.txt_desc,item.desc);

    }


}
